|
자바네트워크I/O |
[1] |
|
등록일:2008-03-12 09:50:36 (0%) 작성자: 제목:Reading and Printing a Directory Hierarchy |
|
import java.io.File;
import java.io.IOException;
public class FileUtil {
public static void main(String[] a)throws IOException{
showDir(1, new File("d:\\Java_Dev"));
}
static void showDir(int indent, File file) throws IOException {
for (int i = 0; i < indent; i++)
System.out.print('-');
System.out.println(file.getName());
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++)
showDir(indent + 4, files[i]);
}
}
}
입력한 폴더의 하위 자료구조를 출력해 주는 예제 |
[본문링크] Reading and Printing a Directory Hierarchy
|
[1]
|
|
|
|
|
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=2517 |
|
|
|
|
|
|
|
|
|
Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.
|
|
|